---
layout: m1x_soap
title: Address Create
---

<h2><a name="customer_address.create-Module%3AMageCustomer"></a>Module: Mage_Customer</h2>

<h3><a name="customer_address.create-Resource%3Acustomeraddress"></a>Resource: customer_address</h3>


<h4><a name="customer_address.create-Method%3A"></a>Method:</h4>

<ul>
	<li>customer_address.create (SOAP V1)</li>
	<li>customerAddressCreate (SOAP V2)</li>
</ul>


<p>Create a new address for the customer</p>

<p><b>Arguments:</b></p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> string </td>
<td> sessionId </td>
<td> Session ID </td>
</tr>
<tr>
<td> int </td>
<td> customerId </td>
<td> Customer ID </td>
</tr>
<tr>
<td> array </td>
<td> addressdata </td>
<td> Array of customerAddressEntityCreate </td>
</tr>
</tbody></table>


<p><b>Returns</b>:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> int </td>
<td> result </td>
<td> ID of the created customer address </td>
</tr>
</tbody></table>


<p>The <b>customerAddressEntityCreate</b> content is as follows:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> string </td>
<td> city <br class="atl-forced-newline" /> </td>
<td> Name of the city </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> company <br class="atl-forced-newline" /> </td>
<td> Name of the company </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> country_id <br class="atl-forced-newline" /> </td>
<td> Country ID </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> fax <br class="atl-forced-newline" /> </td>
<td> Fax </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> firstname <br class="atl-forced-newline" /> </td>
<td> Customer first name </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> lastname <br class="atl-forced-newline" /> </td>
<td> Customer last name </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> middlename <br class="atl-forced-newline" /> </td>
<td> Customer middle name </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> postcode <br class="atl-forced-newline" /> </td>
<td> Postcode </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> prefix <br class="atl-forced-newline" /> </td>
<td> Customer prefix </td>
</tr>
<tr>
<td> int </td>
<td> region_id <br class="atl-forced-newline" /> </td>
<td> ID of the region </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> region <br class="atl-forced-newline" /> </td>
<td> Name of the region </td>
</tr>
<tr>
<td> ArrayOfString </td>
<td> street <br class="atl-forced-newline" /> </td>
<td> Array of street addresses </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> suffix <br class="atl-forced-newline" /> </td>
<td> Customer suffix </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> telephone <br class="atl-forced-newline" /> </td>
<td> Telephone number </td>
</tr>
<tr>
<td> boolean </td>
<td> is_default_billing <br class="atl-forced-newline" /> </td>
<td> True if the address is the default one for billing </td>
</tr>
<tr>
<td> boolean </td>
<td> is_default_shipping <br class="atl-forced-newline" /> </td>
<td> True if the address is the default one for shipping </td>
</tr>
</tbody></table>


<p><b>Note</b>: If you want to leave any address fields empty, specify them as empty ones in the request body.</p>

<h4><a name="customer_address.create-Examples"></a>Examples</h4>

<h5><a name="customer_address.create-RequestExampleSOAPV1"></a>Request Example SOAP V1</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: php; gutter: false">$client = new SoapClient('http://magentohost/api/soap/?wsdl');

// If somestuff requires api authentification,
// then get a session token
$session = $client-&gt;login('apiUser', 'apiKey');

$result = $client-&gt;call(
$session,
'customer_address.create',
array('customerId' =&gt; 2, 'addressdata' =&gt; array('firstname' =&gt; 'John', 'lastname' =&gt; 'Doe', 'street' =&gt; array('Street line 1', 'Streer line 2'), 'city' =&gt; 'Weaverville', 'country_id' =&gt; 'US', 'region' =&gt; 'Texas', 'region_id' =&gt; 3, 'postcode' =&gt; '96093', 'telephone' =&gt; '530-623-2513', 'is_default_billing' =&gt; FALSE, 'is_default_shipping' =&gt; FALSE)));
var_dump ($result);</pre>
		</div>
</div></div>

<h5><a name="customer_address.create-RequestExampleSOAPV2"></a>Request Example SOAP V2</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: php; gutter: false">$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

// If some stuff requires api authentification,
// then get a session token
$session = $client-&gt;login('apiUser', 'apiKey');
$result = $client-&gt;customerAddressCreate($session, '2', array('firstname' =&gt; 'John', 'lastname' =&gt; 'Doe', 'street' =&gt; array('Street line 1', 'Streer line 2'), 'city' =&gt; 'Weaverville', 'country_id' =&gt; 'US', 'region' =&gt; 'Texas', 'region_id' =&gt; 3, 'postcode' =&gt; '96093', 'telephone' =&gt; '530-623-2513', 'is_default_billing' =&gt; FALSE, 'is_default_shipping' =&gt; FALSE));

var_dump ($result);</pre>
		</div>
</div></div>



<h5><a name="customer_address.create-RequestExampleSOAPV2%28WSIComplianceMode%29"></a>Request Example SOAP V2 (WS-I Compliance Mode)</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); 

$sessionId = $proxy-&gt;login((object)array('username' =&gt; 'apiUser', 'apiKey' =&gt; 'apiKey')); 
 
$result = $proxy-&gt;customerAddressCreate((object)array('sessionId' =&gt; $sessionId-&gt;result, 'customerId' =&gt; '2', 'addressData' =&gt; ((object)array(
'city' =&gt; 'Weaverville',
'country_id' =&gt; 'US',
'postcode' =&gt; '96093',
'region' =&gt; 'Texas',
'street' =&gt; array('Street line 1', 'Streer line 2'),
'telephone' =&gt; '847-431-7700',
'lastname' =&gt; 'Doe',
'firstname' =&gt; 'John',
'is_default_billing' =&gt; true
))));   
var_dump($result-&gt;result);</pre>
		</div>
</div></div>

<?php include(__ROOT__ . 'footer.php'); ?>
